﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.WindowsAzure;

namespace BareWeb.FluentAzureDiagnostics.Tests
{
    [TestClass]
    public class WindowsEventLogTest
    {
        [TestMethod]
        public void WindowsEventLogScheduledTransfer_Reflected()
        {
            var target = new DiagnosticsCapture(CloudStorageAccount.DevelopmentStorageAccount);

            var expected = TimeSpan.FromDays(1337D);

            var actual = target.Default()
                .TransferWindowsEventLogEvery(expected)
                .Configuration.WindowsEventLog.ScheduledTransferPeriod;

            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void WindowsEventLogQuota_Reflected()
        {
            var target = new DiagnosticsCapture(CloudStorageAccount.DevelopmentStorageAccount);

            var expected = 1337;

            var actual = target.Default()
                .WithWindowsEventLogQuotaInMBOf(expected)
                .Configuration.WindowsEventLog.BufferQuotaInMB;

            Assert.AreEqual(expected, actual);
        }
        [TestMethod]
        public void WindowsEventLogLogLevel_Reflected()
        {
            var target = new DiagnosticsCapture(CloudStorageAccount.DevelopmentStorageAccount);

            var expected = Microsoft.WindowsAzure.Diagnostics.LogLevel.Error;

            var actual = target.Default()
                .WhereWindowsEventLogAreAbove(expected)
                .Configuration.WindowsEventLog.ScheduledTransferLogLevelFilter;

            Assert.AreEqual(expected, actual);
        }
    }
}
